home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 412_01 / include / aosearch.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-01  |  1.6 KB  |  54 lines

  1. /*                    AOSEARCH_
  2.  
  3.     The base class AOSEARCH_ defines a skeleton search class from
  4.     which more the actual search classes such as AODEPTH_TREE_
  5.     are derived, cf. class SEARCH_. It processes objects of class
  6.     AONODE_.
  7.  
  8.     A class that is derived from AOSEARCH_ should pass the start node
  9.     and the number of operators on to the constructor of AOSEARCH_.
  10.     Also it must be implement the folllowing function:
  11.  
  12.     is_terminal() :  determines if a node is a terminal node,
  13.                      1 : yes, 0 : no
  14.  
  15. */
  16.  
  17. #ifndef _aosearch_H_
  18. #define _aosearch_H_
  19.  
  20. #include <stdio.h>
  21. #include "list.h"
  22. #include "nodes.h"
  23. #include "nodes.h"
  24. #include "nodes.h"
  25.  
  26. class AOSEARCH_
  27. {
  28.     public:
  29.         AOSEARCH_(AONODE_ *start, int numop);
  30.         virtual ~AOSEARCH_();
  31.  
  32.         void generate();         // starts search process 
  33.         int solve();             // actual search engine together with add()
  34.         void print_sol(AONODE_ *);        // prints solution
  35.         int solvable(AONODE_ *);          // labels nodes SOLVED
  36.         int unsolvable(AONODE_ *);        // labels nodes UNSOLVED
  37.         void prune(int);                  // prunes nodes from open 
  38.         int deletable(AONODE_ *, int);    // determines if a node may be pruned
  39.  
  40.         virtual void add(AONODE_ *) = 0;                  // adds node to open
  41.         virtual int is_terminal(const AONODE_ &) = 0;     // node is terminal?
  42.  
  43.     private:
  44.         int
  45.             num_op;         // the number of operators to be used
  46.         AONODE_
  47.               *startnode;       // initial node
  48.     protected:
  49.     LIST_ open,
  50.           closed;    
  51. };
  52.  
  53. #endif
  54.